Skip to main content

MCP

BindAI provides a lightweight HTTP-based MCP integration package for discovering and invoking external tools. The current implementation is intentionally small and focused on connecting BindAI’s tool system to an HTTP service that exposes a simple tool-discovery and tool-invocation interface. It should be understood as a lightweight HTTP bridge, not as a complete implementation of the Model Context Protocol.

Current MCP Scope

The bindai-mcp package currently provides:
  • MCPClient
  • MCPTool
  • HTTP-based tool discovery
  • HTTP-based tool invocation
  • Tool metadata and schema mapping
  • Integration with the BindAI tool abstraction
The current implementation does not attempt to implement the complete MCP protocol. The package provides a practical integration boundary for external tools while keeping the external HTTP communication behind the BindAI tool abstraction.

MCP Package

The package is:
Its public API currently exposes:
The package currently depends on:
The package itself declares:

Architecture

The current implementation can be understood as:
The external service exposes tools through a small HTTP interface. MCPClient discovers those tools and creates MCPTool instances that can participate in the BindAI tool system.

MCPClient

MCPClient is the client used to communicate with the external HTTP tool service. Create a client with the service URL:
The client currently stores the configured URL and provides asynchronous tool discovery through:
The client does not currently provide explicit connect() or disconnect() methods. It also does not maintain a persistent MCP session.

Tool Discovery

Tool discovery is performed with:
The current implementation sends:
For example:
The response is expected to contain a JSON list of tool definitions. A conceptual response is:
Each returned item is converted into an MCPTool.

Tool Metadata

An externally discovered tool can provide:
  • name
  • description
  • schema
The schema is optional. If no description is provided, the implementation uses an empty string. If no schema is provided, the implementation uses an empty dictionary. For example:
The resulting BindAI tool exposes the same metadata through its tool definition.

MCPTool

MCPTool is the BindAI Tool implementation created for each discovered external tool. Its public properties include:
The tool definition contains:
  • tool name
  • tool description
  • parameter schema
For example:
produces a BindAI ToolDefinition containing the discovered metadata. This allows an external HTTP tool to participate in BindAI’s existing tool abstraction.

Tool Invocation

When an MCPTool is executed, the current implementation sends:
For example:
The JSON request body has the following structure:
The tool field contains the name of the discovered tool. The arguments field contains the arguments supplied by the BindAI execution context.

Tool Arguments

When an MCPTool receives an execution context containing variables, those variables are used as the tool arguments. For example:
results in a request equivalent to:
If the execution context does not provide variables, the implementation uses an empty argument dictionary. The current MCP implementation does not perform additional argument transformation or validation beyond the behavior provided by the underlying BindAI tool definition and external service.

Tool Results

After invoking the external service, the response body is parsed as JSON. The JSON response is returned through BindAI’s ToolResult:
For example, if the external service returns:
the BindAI tool result contains that object as its output.

HTTP Errors

The current implementation calls:
for HTTP requests. Therefore, HTTP error responses result in an exception rather than being converted into a successful ToolResult. Applications should handle these failures at the appropriate application or agent boundary. A conceptual flow is:

MCP and BindAI Tools

The main purpose of the package is to bridge external HTTP tools into the BindAI tool system. The relationship is:
This allows an application to combine locally implemented tools with tools exposed by an external service. The agent can interact with the resulting tools through BindAI’s normal tool abstraction.

MCP and Agents

An application can expose discovered MCPTool instances to an agent using the normal BindAI tool mechanisms. The conceptual flow is:
The agent does not need to implement the external service’s HTTP request format directly. The MCP integration keeps that communication inside the tool implementation.

MCP and Workflows

MCP tools can participate in workflows when they are exposed through BindAI’s normal tool system. For example:
The workflow remains responsible for orchestration. The MCP package provides the external tool boundary. Features such as conditions, loops, parallel execution, retries, timeouts, and human tasks belong to the corresponding BindAI workflow or automation systems rather than to bindai-mcp itself.

MCP and Automation

The bindai-mcp package does not currently provide its own automation or event-trigger integration. MCP tools may still be used by applications that also use BindAI automation and event infrastructure, provided the tools are registered through the normal BindAI mechanisms. For example:
The automation layer and MCP layer remain separate responsibilities.

Observability

The bindai-mcp package does not currently provide a dedicated MCP observability system. It also does not itself expose MCP-specific event types or an MCP event recorder. Applications can still observe MCP-backed tool execution through whatever logging, instrumentation, or execution observability they apply around the BindAI tool and agent layers. BindAI’s broader runtime observability facilities can therefore be used at the application level without implying that the MCP package itself implements tracing or monitoring.

Configuration

The current MCPClient requires only a URL:
The package does not define a dedicated MCP configuration file format. It also does not define built-in environment variables such as:
Applications are free to obtain the URL and any required credentials from their own configuration system. For example:
The exact configuration mechanism is an application concern.

Authentication

The current MCPClient implementation does not provide a built-in authentication mechanism. In particular, the current client does not expose configuration for:
  • API keys
  • Bearer tokens
  • OAuth
  • client certificates
  • custom authentication headers
If the external service requires authentication, the application must provide an appropriate integration mechanism or extend the client implementation. Do not assume that an MCP service is authenticated simply because it is reachable over HTTP.

Security

MCP-backed tools can provide access to external systems and should therefore be treated as security-sensitive application components. Applications should consider:
  • Authentication
  • Authorization
  • TLS
  • Network restrictions
  • Input validation
  • External service permissions
  • Tool permissions
  • Secret management
  • Logging of sensitive information
The current bindai-mcp client does not implement these concerns itself. Do not expose sensitive external operations to agents unless the application intentionally allows them.

Tool Permissions

External services may expose tools that perform different levels of access. For example:
Applications should decide which discovered tools are appropriate for each agent. Avoid automatically exposing sensitive or destructive operations to every agent. Use the principle of least privilege when deciding which external tools an agent can invoke.

Timeouts and Reliability

The current MCPClient does not expose a configurable timeout parameter. The underlying HTTP behavior is provided by httpx. Applications that require strict timeout, retry, circuit-breaker, or resilience policies should account for this at the application or integration layer. External HTTP services can fail because of:
  • Network problems
  • Service outages
  • Invalid requests
  • Authentication failures
  • HTTP errors
  • Unexpected responses
  • Latency or timeout conditions
Treat MCP-backed tools as external dependencies.

Testing

The bindai-mcp package includes tests for its core behavior. The current test coverage verifies:
  • Tool discovery
  • Tool metadata
  • Tool schema mapping
  • BindAI ToolDefinition generation
  • Tool invocation
  • Tool argument forwarding
  • Tool result handling
The discovery test verifies that a response from:
is converted into MCPTool instances. The invocation test verifies that:
receives the expected tool name and arguments. A representative test boundary is:
The current tests mock the HTTP layer rather than contacting a production MCP service.

Example Test Contract

A discovered tool can look like:
The resulting tool should expose:
When executed with:
the external service should receive:

HTTP Bridge Contract

The current bridge has two core endpoints.

Tool discovery

Expected response:

Tool invocation

Expected request:
Expected response:
The exact response payload is not transformed into a special MCP response structure. The JSON returned by the external service becomes the output of the BindAI ToolResult.

Example Usage

A minimal application can discover external tools with:
The discovered tools can then be integrated with the application’s normal BindAI tool configuration.

Docker

The MCP package itself does not start an HTTP server. It is a client-side integration package that communicates with an already-running HTTP service. When BindAI runs inside Docker, the configured MCP service must be reachable from the container. For example:
If the external service runs in another Docker container, the containers must be able to communicate over the appropriate Docker network. If the service is external, the BindAI container needs appropriate outbound network access.

Docker Compose

A Docker Compose deployment can include a BindAI application and an external HTTP tool service:
The exact service configuration depends on the external HTTP tool provider. The bindai-mcp package itself does not provide a server container or Compose service.

Current Limitations

The current implementation is intentionally lightweight. It should not be described as a complete MCP protocol implementation. The current package does not implement a complete MCP stack including features such as:
  • Full protocol negotiation
  • MCP session management
  • MCP resources
  • MCP prompts
  • Multiple MCP transport implementations
  • Standard MCP server implementation
  • Built-in authentication
  • OAuth flows
  • MCP-specific tracing
  • Full protocol compliance across MCP features
The current implementation is specifically centered on:
and the conversion of discovered external tools into BindAI Tool objects.

MCP vs BindAI Connections

MCP and BindAI Connections provide different integration approaches. Use a BindAI Connection when BindAI provides a dedicated integration for the service. Use bindai-mcp when the required capability is exposed through the compatible HTTP tool bridge.

MCP vs Local Tools

Local tools execute application-defined Python code. MCP tools represented by MCPTool forward execution to an external HTTP service. Local tool:
MCP-backed tool:
Both can participate in the BindAI tool system. The primary difference is where the actual operation executes.

Recommended Project Structure

An application using the MCP bridge may keep MCP-related setup separate from agents and workflows:
The exact project structure is application-specific. The important principle is to keep external-service configuration and credentials separate from agent business logic.

Production Considerations

When deploying an application that uses the MCP bridge, consider:
  • External service availability
  • Network connectivity
  • Authentication requirements
  • TLS
  • Tool permissions
  • Input validation
  • HTTP failures
  • Timeouts
  • Retry policies
  • Rate limits
  • External service monitoring
  • Secret management
The current MCP package is intentionally minimal, so production applications may need additional infrastructure around it. A production application should define what happens when an external tool service becomes unavailable.

Future MCP Capabilities

The MCP integration can be expanded in future releases. Potential areas include:
  • More complete MCP protocol support
  • Standard MCP transports
  • MCP resources
  • MCP prompts
  • Session management
  • Authentication support
  • Richer tool metadata
  • Improved protocol compatibility
  • MCP server functionality
  • More advanced error and timeout handling
  • Deeper observability integration
These capabilities should be introduced incrementally while preserving the existing BindAI tool abstraction where practical.

Best Practices

  • Treat external MCP-backed services as external dependencies.
  • Keep MCP configuration separate from agent business logic.
  • Never hard-code credentials.
  • Use secure configuration and secret storage.
  • Expose only the tools an agent actually needs.
  • Follow least-privilege principles.
  • Validate external tool inputs.
  • Handle HTTP failures explicitly.
  • Use appropriate timeout and retry strategies at the application level.
  • Test MCP integrations independently.
  • Do not assume authentication is provided by bindai-mcp.
  • Do not assume MCP resources or prompts are supported.
  • Do not assume session management is available.
  • Do not describe the v0.1 implementation as full MCP protocol compliance.
  • Verify the capabilities of the external HTTP service before depending on them.

Summary

BindAI v0.1 provides a lightweight HTTP-based MCP integration through the bindai-mcp package. The main flow is:
The current implementation provides:
  • MCPClient
  • MCPTool
  • HTTP tool discovery
  • HTTP tool invocation
  • Tool metadata and schema mapping
  • BindAI Tool integration
  • JSON tool results
The current implementation is intentionally smaller than a complete MCP protocol stack. For v0.1, the MCP layer should therefore be viewed as a practical HTTP tool bridge and foundation for future MCP capabilities, rather than as a full MCP implementation. Applications that require specific MCP protocol features should verify that those features are supported before depending on them.